<?php
class Order_model extends CI_Model {
	
	function Order_model() {
		parent::__construct ();
		$this->load->database ();
	}
	
	function get($id = 0) {
		if ($id == 0 ) {
			$query = $this->db->get ( 'orders' );
			return $query->result_array ();
		} else {	
			$this->db->where ( 'id', $id );
			$query = $this->db->get ( 'orders' );
			return $query->first_row (); 
		}
	}
	
	function update($id, $data) {
		$this->db - where ( 'id', $id );
		$this->db->update ( 'orders', $data );
	}
	
	function delete($id) {
		$this->db->where ( 'id', $id );
		return $this->db->delete ( 'orders' );
	}
	
	function add($data) {
		return $this->db->insert ( 'orders', $data );
	}

}